#ifndef BASE_NETWORK_H_INCLUDED_
#define BASE_NETWORK_H_INCLUDED_

#include <stdio.h>
#include <string.h>
#include "lw_oopc.h"

typedef enum
{
    NETWORK_TCP_SERVER = 100,
    NETWORK_TCP_CLIENT = 101,
    NETWORK_UDP_SERVER = 201,
    NETWORK_UDP_CLIENT = 201,
} NETWORK_TYPE;

ABS_CLASS(Network)
{
    char name[64];
    char address[16];
    int port;
    NETWORK_TYPE type;

    void (*setName)(Network *t, const char *name);
    void (*setAddress)(Network *t, const char *address);
    void (*setPort)(Network *t, int port);
    void (*SendSync)(Network *t, const char *data, size_t data_len);
    void (*SendAsync)(Network *t, const char *data, size_t data_len);
    size_t (*RecvSync)(Network *t, char *data);
    size_t (*RecvAsync)(Network *t, char *data);
    void (*Init)(Network *t, const char *name, const char *address, int port);
};

#endif // ! BASE_NETWORK_H_INCLUDED_